# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def inorderTraversal(self, root):
        """
        :type root: TreeNode
        :rtype: List[int]
        """
        if not root:
            return []
        a = []
        b = []
        node = root
        while node or a:

            while node:
                a.append(node)
                node = node.left
            node = a.pop()
            b.append(node.val)
            node = node.right
        return b
